import { MockMethod } from "vite-plugin-mock"

export default [
  {
    url: "/dev-api/system/role/search",
    timeout: 2000,
    method: "post",
    response: () => {
      return {
        "code": 20000,
        "message": "查询成功",
        "data": {
          "total": "@integer(100, 200)", // 总记录数
          "records|20": [{ //生成20条数据
            "id|+1": 1, //初始值1开始，每条+1
            "roleName|1": ['超级管理员', '售前客服', '售后客服'],
            "roleCode": "ROLE_" + "@word(5)", // ROLE_5个英文字符
            'status|10-2': true, // Boolean, 生成 true 概率 10/(10+2), false 概率 2/(10+2)
            "remark": "@ctitle",
            "createTime": "@date", // 随机创建时间
            "updateTime": "@date", // 随机更新时间
          }]
        }
      }
    }
  },
  {
    url: "/dev-api/system/role/:id/menu/ids",
    timeout: 2000,
    method: "get",
    response: () => {
      return {
        "code": 20000,
        "message": "成功！",
        "data": [ // 为了匹配菜单id，数据写死
          "1111",
          "2222",
          "22221",
          "222211",
          "222212",
          "222213",
          "222214"
        ]
      }
    }
  },
  {
    url: "/dev-api/system/role/:id",
    timeout: 2000,
    method: "delete",
    response: () => {
      return {
        "code": 20000,
        "message": "删除成功",
        "data": true
      }
    }
  },
  {
    url: "/dev-api/system/role/list",
    timeout: 2000,
    method: "get",
    response: () => {
      return {
        "code": 20000,
        "message": "查询成功",
        "data|3": [{
          "id|+1": 1,
          "roleName|1": ['超级管理员@word(2)', '售前客服@word(2)', '售后客服@word(2)']
        }]
      }
    }
  },
] as MockMethod[]